# 1. @property 将函数内容转为属性
class Person:
    def __init__(self, name, age):
        self.__name = name
        self.__age = age

    # @property
    def get_age(self):
        return self.__age

# 2. @property.setter
#     @age.setter
    def set_age(self, age):
        self.__age = age
# 3. @property.deleter 删除属性
#     @age.deleter
    def del_age(self):
        del self.__age
        print('删除属性')
# 4. 使用property包装
    age = property(get_age, set_age, del_age)

person = Person('张三', 18)
person.age = 200
print(person.age)

